#ifndef __SYSTEM_CONFIG_H
#define __SYSTEM_CONFIG_H

typedef enum __baud_rate{B1200, B2400, B4800, B9600, B19200, B38400, B57600, B115200}BaudRate;

typedef struct __system_config_data{
    unsigned int H;
    unsigned char ADDH;
    unsigned char ADDL;
    unsigned char REG0;
    unsigned char REG1;
    unsigned char REG2;
    unsigned char REG3;
    unsigned char CRYPT_H;
    unsigned char CRYPT_L;
    unsigned short pulse_hold;
    unsigned char device_addr;
    unsigned char parity;
    unsigned int baud_rate;
    unsigned int T;
}SystemConfig;

extern SystemConfig sysConfigData;
extern int sysConfigChanged;
extern int sysConfigRead;
extern int sysConfigReadAddr;
extern int sysConfigReadLen;

void loadSystemConfig(void);
void loadDefaultConfig(void);
void readSystemConfig(SystemConfig *config);
void writeSystemConfig(const SystemConfig *config);
void changeLoraAddr(unsigned short addr);
void changeLoraCH(unsigned char ch);
void changeLoraCrypt(unsigned short crypt);
int getBaudRateVal(BaudRate rate);

#endif // __SYSTEM_CONFIG_H
